package com.awn.weidian.demo.mapper;

import com.awn.weidian.demo.pojo.Address;

import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface IAddress {




        @Select("select x.*,u.* from address x left join (select c.rid q ,c.rname w ,d.arid e,d.arname r,d.brid t ,d.brname y from region c right join (select a.father afather,a.rid arid,a.rname arname,b.rid brid,b.rname brname from region a right join (select rname,rid,father from region) b on a.rid = b.father) d on d.afather = c.rid) u on u.t = x.rid where x.uid =#{uid}")
        public List<Address> showAll();

//	@Select("select * from address limit #{aa},#{bb}")
//	public List<Map<String,Object>> fenye(int aa,int bb);

        @Select("select count(uid) from address")
        public int show();


//	@Select("select * from address where aid=#{aa}")
//	public List<Address> findaid(String aa);


        @Insert("insert into address(uid,rid,useraddress) values(#{uid},#{rid},#{useraddress})")
        public int Add(Address address);


        @Update("update address set uid=#{uid},rid=#{rid},useraddress=#{useraddress} where aid=#{aid}")
        public int updateAll(Address address);

        @Delete("delete from address where aid = #{aid}")
        public int Delect(int aid);


}
